<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自定义元素</title>
    <style>
        html,body{height: 100%;}
        body{
            display: grid;
            place-items: center;
        }
        :not(:defined){
            width: 120px;
            height:60px;
            background:gray linear-gradient(
                60deg, transparent, transparent,
                20%,white 40%,transparent 60%) 0/ 300%;
            border-radius: 15px;
            animation: loading 2s infinite;

        }
        @keyframes loading {
            to{
                background-position: 300% 0;
            }
        }
    </style>
</head>
<body>
    <long-time-no-see></long-time-no-see>
    <script>
        setTimeout(() => customElements.define(
            'long-time-no-see',
            class extends HTMLElement{
                constructor (){
                    super()
                    this.innerHTML='<h1>我是自定义的元素</h1>'
                }
            }
        ), 3000);
        
        customElements.whenDefined
    </script>
</body>
</html>